package com.itmhw;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;

/**
 * 启动类
 *
 * @author mhw
 * @since 2022/12/8 18:44
 */
@SpringBootApplication
@EnableFeignClients(basePackages = "com.hmall.common.client")
public class SearchApplication {
    public static void main(String[] args) {
        SpringApplication.run(SearchApplication.class, args);
    }
    @Bean
    public RestHighLevelClient client(){
        //创建连接
        return  new RestHighLevelClient(RestClient.builder(HttpHost.create("http://192.168.144.133:9200")));
    }
}
